# Moths - an environment for mathy calculations
# Copyright (C) 2006 Mike Sutjipto
# Licensed under the GPL

module Moths
  
  # Not really an expression - this aspect of the language basically
  # allows one to define functions/variables, i.e.
  # => def func_name arg1 arg2 = arg1 * arg2
  #
  # TODO definitions might eventually be generalized into an expression,
  #      so as to allow for first-class and anonymous functions (via lambda 
  #      calc), and maybe even curried functions
  #
  class Definition
    @id
    @arg_list
    @expr

    attr_reader :id, :expr, :arg_list

    def initialize(id, arg_list = nil, expr = nil)
      @id = id
      @arg_list = arg_list
      @expr = expr
    end

    # Returns the number of arguments this function was defined with
    #
    def arg_num
      return @arg_list.length
    end

    def to_s
      return @id + '(' + @argList.join(', ') + ') = ' + @expr.to_s
    end

    def eval
      return ''
    end
  end
  
end
